//
//  ReViewsCell.m
//  hai游～
//
//  Created by jakf_17 on 15/5/23.
//  Copyright (c) 2015年 jakf_17. All rights reserved.
//

#import "ReViewsCell.h"

@implementation ReViewsCell


- (void)dealloc
{
    [_userName release];
    [_userImage release];
    [_contentImage release];
    [_contentLabel release];

    [super dealloc];
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createMyUser];
    }
    return self;
}
- (void)createMyUser
{
    self.userImage = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 40, 40)];
    _userImage.layer.cornerRadius = 20;
    _userImage.layer.masksToBounds = YES;
    [self.contentView addSubview:_userImage];
    [_userImage release];
    
    self.userName = [[UILabel alloc] initWithFrame:CGRectMake(58, 5, 100, 20)];
    _userName.font = [UIFont systemFontOfSize:15];
    [self.contentView addSubview:_userName];
    _userName.textColor = [UIColor colorWithRed:102 / 255.0 green:153 / 255.0 blue:204 / 255.0 alpha:1];
    [_userName release];
    
    self.contentLabel = [[UILabel alloc] initWithFrame:CGRectZero];
    _contentLabel.font = [UIFont systemFontOfSize:12];
    _contentLabel.numberOfLines = 0;
    [self.contentView addSubview:_contentLabel];
    [_contentLabel release];
    
    self.contentImage = [[UIImageView alloc] initWithFrame:CGRectZero];
    [self.contentView addSubview:_contentImage];
    [_contentImage release];
    
    }
- (void)layoutSubviews
{
    [super layoutSubviews];
    NSString *str = _contentLabel.text;
    NSDictionary *dic = @{NSFontAttributeName:[UIFont systemFontOfSize:13]};
    CGRect rect = [str boundingRectWithSize:CGSizeMake([[UIScreen mainScreen] bounds].size.width - 10, 10000) options:NSStringDrawingUsesLineFragmentOrigin attributes:dic context:nil];
    _contentLabel.frame = CGRectMake(5, 48, rect.size.width - 10, rect.size.height);
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
